package cn.kgc.mushroomwebui.controller;

import cn.kgc.mushroomcommon.api.ManagerRemoteService;
import cn.kgc.mushroomcommon.pojo.Commodity;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("commodity")
public class CommodityController {

    @Resource
    ManagerRemoteService managerRemoteService;

    @RequestMapping("/selectcomm")
    public List<Commodity>  selectcomm(){
         List<Commodity> selectcomm = managerRemoteService.selectcomm();
         return selectcomm;
    }

    @RequestMapping("/selectTop")
    public List<Commodity> selectTop(){
        List<Commodity> commodities = managerRemoteService.selectTop();
        return commodities;
    }

    @RequestMapping("/selectByid")
    public List<Commodity> selectByid(@RequestParam("tidcommtype")Integer tidcommtype){
        List<Commodity> commodities = managerRemoteService.selectByid(tidcommtype);
        return commodities;
    }

    @RequestMapping("/select/commodity/commandtype")
    public List<Commodity> selectCommonities(@RequestParam("commOrTypeName")String commOrTypeName,
                                             @RequestParam("tiaojian")Integer tiaojian,
                                             @RequestParam("smallMoney")Integer smallMoney,
                                             @RequestParam("bigMoney")Integer bigMoney){
        List<Commodity> commodities = managerRemoteService.selectCommonities(commOrTypeName,tiaojian,smallMoney,bigMoney);
        return commodities;
    }

    @RequestMapping("/selectshopallname")
    public List<Commodity> selectshopallname(@RequestParam("tid")Integer tid){
        List<Commodity> commodities = managerRemoteService.selectshopallname(tid);
        return commodities;
    }
}
